#pragma once
#include <cstdint>

struct TscCalib {
    double ghz{0.0};
    bool   ok{false};
};

class TscSource {
public:
    static TscCalib init(double calib_seconds = 0.2);
    static inline uint64_t now_ns() {
        return static_cast<uint64_t>(ticks_to_ns(now_ticks()));
    }
    static uint64_t now_ticks();
    static int64_t  ticks_to_ns(uint64_t);
    static double   ghz();
    static bool     ok();
private:
    static TscCalib g_calib;
};

//
void run_tsc_demo(int N = 15, int interval_ms = 200);
